package com.bw.dao;

import com.bw.pojo.Goods;
import org.apache.ibatis.annotations.*;

import java.util.List;


/***************************
 FileAction: 这个接口文件负责提供 商品表的增 删 改 查

 CreateTime:2022-07-27 14:52
 Author:Aaking-aline
 ****************************/
public interface GoodsDao {

	@Insert("insert into goods values(null,#{goods_name},#{goods_price},#{goods_img},#{goods_stock})")
	void insertGoods(Goods goods);

	@Delete("delete from goods where id = #{id}")
	void deleteGoods(String id);

	@Update("update goods set goods_name = #{goods_name},goods_price = #{goods_price},goods_img = #{goods_img},goods_stock = #{goods_stock} where id = #{id}")
	void updateGoods(Goods goods);

	@Select("select * from goods")
	List<Goods> selectAllGoods();

	@Select("select * from goods order by price desc")
	List<Goods> selectGoodsOrderByPrice();

	@Select("select * from goods limit #{arg0},#{arg1}")
	List<Goods> selectGoodsLimit(Integer index, Integer num);

}
